<aside id="dash-aside">

    <?php
        if (is_page()) {
            $current_url_link = get_permalink();
        }
        $plazo = $_GET['plazo'];
    ?>
    
    <div id="user-info">
        <h3><?php $user = wp_get_current_user();
                echo get_user_meta($user->ID, 'name_profile', true); ?></h3>
        <img src="<?php echo get_template_directory_uri(); ?>/images/user.jpg" />
    </div>

    <nav id="menu">

        <ul>

            <li>
                <a href="<?php echo Helpers::get_dashboard_url(); ?>" class="b-escritorio  <?php
                    if (Helpers::get_dashboard_url() == $current_url_link) {
                        echo 'selected-dashboard-item';
                    }
                    ?>">Escritorio</a>
            </li>

            <li>
                <a href="<?php echo Helpers::get_profile_url(); ?>" class="b-profile <?php
                   if (Helpers::get_profile_url() == $current_url_link) {
                       echo 'selected-dashboard-item';
                   }
                    ?>">Perfil</a>
            </li>

            <li>
                <a class="b-registro <?php
                    if (Helpers::get_user_register_url() == $current_url_link) {
                        echo 'selected-dashboard-item';
                    }
                    ?>" href="<?php echo Helpers::get_user_register_url(); ?>">Registro de Consumo</a>
            </li>

            <li class="desplegable <?php if(is_page_template('template_visualization_water.php') || is_page_template('template_visualization_electricity.php') || is_page_template('template_visualization_fuel.php')){ echo 'activa';}?>">
                <a class="b-visualizacion" >Visualización <span class="toggle"></span></a>
                <ul>
                    <li><a href="<?php echo Helpers::get_visualization_url("agua"); ?>" class="<?php
                        if (Helpers::get_visualization_url("agua") == $current_url_link) {
                            echo 'selected-dashboard-item';
                        }
                        ?>">Agua</a></li>
                    <li><a href="<?php echo Helpers::get_visualization_url("electricidad"); ?>" class="<?php
                        if (Helpers::get_visualization_url("electricidad") == $current_url_link) {
                            echo 'selected-dashboard-item';
                        }
                        ?>">Electricidad</a></li>
                    <li><a href="<?php echo Helpers::get_visualization_url("combustible"); ?>" class="<?php
                        if (Helpers::get_visualization_url("combustible") == $current_url_link) {
                            echo 'selected-dashboard-item';
                        }
                        ?>">Combustible</a></li>
                </ul>
            </li>

            <?php
                $show_good_practices = false;
                $term = "";

                if (is_tax('tipo-consumo') || is_tax('plazo')) {
                    $show_good_practices = true;
                    $term = single_term_title("", false);
                }
                $subterm_list = array("Corto Plazo", "Mediano Plazo", "Largo Plazo");
            ?>

            <li class="desplegable <?php if($show_good_practices){ echo 'activa';} 
                if (Helpers::get_good_practices_url() == get_permalink()) {
                        echo 'activa';
                    }?> " >

                <a class="b-buenas-practicas" >Buenas pr&aacute;cticas <span class="toggle"></span></a>

                <ul>
                    <li class="li-child">
                        <a class="<?php
                    if (Helpers::get_good_practices_url() == get_permalink()) {
                        echo 'selected-dashboard-item';
                    }
                ?>" href="<?php echo Helpers::get_good_practices_url(); ?>">Todas las BPA's</a>
                    </li>

                    <li class="li-child ">

                        <a href="<?php echo Helpers::get_consumption_type_url("agua"); ?>" class="<?php if ($term == "Agua") echo 'selected-dashboard-item'; ?>">Agua</a>

                        <ul <?php if ($term == "Agua") echo 'style="display:block;"'; ?> >
                            <li><a href="<?php echo Helpers::get_consumption_type_filtered_url('agua', 'corto-plazo'); ?>"  class="<?php
                                if ($term == "Agua" && $plazo == "corto-plazo") {
                                    echo 'selected-dashboard-item';
                                }
                                ?>">Corto Plazo</a></li>
                            <li><a href="<?php echo Helpers::get_consumption_type_filtered_url('agua', 'mediano-plazo'); ?>"  class="<?php
                                if ($term == "Agua" && $plazo == "mediano-plazo") {
                                    echo 'selected-dashboard-item';
                                }
                                ?>">Mediano Plazo</a></li>
                            <li><a href="<?php echo Helpers::get_consumption_type_filtered_url('agua', 'largo-plazo'); ?>"  class="<?php
                                if ($term == "Agua" && $plazo == "largo-plazo") {
                                    echo 'selected-dashboard-item';
                                }
                                ?>">Largo Plazo</a></li>
                        </ul>

                    </li>

                    <li class="li-child">

                        <a href="<?php echo Helpers::get_consumption_type_url("energia"); ?>"  class="<?php if ($term == "Energia") echo 'selected-dashboard-item'; ?>">Energía</a>

                        <ul <?php if ($term == "Energia") echo 'style="display:block;"'; ?>>
                            <li><a href="<?php echo Helpers::get_consumption_type_filtered_url('energia', 'corto-plazo'); ?>" class="<?php
                                if ($term == "Energia" && $plazo == "corto-plazo") {
                                    echo 'selected-dashboard-item';
                                }
                                ?>">Corto Plazo</a></li>

                            <li><a href="<?php echo Helpers::get_consumption_type_filtered_url('energia', 'mediano-plazo'); ?>" class="<?php
                                if ($term == "Energia" && $plazo == "mediano-plazo") {
                                    echo 'selected-dashboard-item';
                                }
                                ?>">Mediano Plazo</a></li>

                            <li><a href="<?php echo Helpers::get_consumption_type_filtered_url('energia', 'largo-plazo'); ?>" class="<?php
                                if ($term == "Energia" && $plazo == "largo-plazo") {
                                    echo 'selected-dashboard-item';
                                }
                                ?>">Largo Plazo</a></li>
                        </ul>

                    </li>

                </ul>

            </li>

            <li>
                <a href="<?php echo Helpers::get_user_contact_url(); ?>" class="contacto <?php
                   if (Helpers::get_user_contact_url() == $current_url_link) {
                       echo 'selected-dashboard-item';
                   }
                    ?>">Contacto</a>
            </li>

        </ul>

    </nav>
    
    
    <nav id="menu-mobile">
        <ul>
            <li>
                <a href="<?php echo Helpers::get_dashboard_url(); ?>" class="b-escritorio <?php if (Helpers::get_dashboard_url() == $current_url_link) echo 'selected-dashboard-item'; ?>" >Escritorio</a>
            </li>
            <li>
                <a href="<?php echo Helpers::get_profile_url(); ?>" class="b-visualizacion <?php if (Helpers::get_profile_url() == $current_url_link) echo 'selected-dashboard-item'; ?>">Perfil</a>
            </li>
            <li>
                <a href="<?php echo Helpers::get_user_register_url(); ?>" class="b-registro <?php if (Helpers::get_user_register_url() == $current_url_link) echo 'selected-dashboard-item'; ?>">Registro de Consumo</a>
            </li>
            <li>
                <a class="b-visualizacion">Visualizaci&oacute;n</a>
                <ul style="display: block;">
                    <li><a href="<?php echo Helpers::get_visualization_url("agua"); ?>" class="<?php if (Helpers::get_visualization_url("agua") == $current_url_link) echo 'selected-dashboard-item'; ?>">Agua</a></li>
                    <li><a href="<?php echo Helpers::get_visualization_url("electricidad"); ?>" class="<?php if (Helpers::get_visualization_url("electricidad") == $current_url_link) echo 'selected-dashboard-item'; ?>">Electricidad</a></li>
                    <li><a href="<?php echo Helpers::get_visualization_url("combustible"); ?>" class="<?php if (Helpers::get_visualization_url("combustible") == $current_url_link) echo 'selected-dashboard-item'; ?>">Combustible</a></li>
                </ul>
            </li>
            <li href="<?php echo Helpers::get_good_practices_url(); ?>" class=" if($show_good_practices){ echo 'desplegable ';}?>">
                <a class="b-buenas-practicas <?php if (Helpers::get_good_practices_url() == get_permalink()) echo 'selected-dashboard-item'; ?>" href="<?php echo Helpers::get_good_practices_url(); ?>" >Buenas pr&aacute;cticas</a>
                <ul style="display:block;">
                    <li class="li-child">
                        <a href="<?php echo Helpers::get_consumption_type_url("agua"); ?>" class="<?php if ($term == "Agua") echo 'selected-dashboard-item'; ?>">Agua</a>
                        <ul <?php if ($term == "Agua") echo 'style="display:block;"'; ?> >
                            <li><a href="<?php echo Helpers::get_consumption_type_filtered_url('agua', 'corto-plazo'); ?>"  class="<?php if ($term == "Agua" && $plazo == "corto-plazo") echo 'selected-dashboard-item'; ?>">Corto Plazo</a></li>
                            <li><a href="<?php echo Helpers::get_consumption_type_filtered_url('agua', 'mediano-plazo'); ?>"  class="<?php if ($term == "Agua" && $plazo == "mediano-plazo") echo 'selected-dashboard-item'; ?>">Mediano Plazo</a></li>
                            <li><a href="<?php echo Helpers::get_consumption_type_filtered_url('agua', 'largo-plazo'); ?>"  class="<?php if ($term == "Agua" && $plazo == "largo-plazo") echo 'selected-dashboard-item'; ?>">Largo Plazo</a></li>
                        </ul>
                    </li>

                    <li class="li-child">
                        <a href="<?php echo Helpers::get_consumption_type_url("energia"); ?>"  class="<?php if ($term == "Energia") echo 'selected-dashboard-item'; ?>">Energía</a>
                        <ul <?php if ($term == "Energia") echo 'style="display:block;"'; ?>>
                            <li><a href="<?php echo Helpers::get_consumption_type_filtered_url('energia', 'corto-plazo'); ?>" class="<?php if ($term == "Energia" && $plazo == "corto-plazo") echo 'selected-dashboard-item'; ?>">Corto Plazo</a></li>
                            <li><a href="<?php echo Helpers::get_consumption_type_filtered_url('energia', 'mediano-plazo'); ?>" class="<?php if ($term == "Energia" && $plazo == "mediano-plazo") echo 'selected-dashboard-item'; ?>">Mediano Plazo</a></li>
                            <li><a href="<?php echo Helpers::get_consumption_type_filtered_url('energia', 'largo-plazo'); ?>" class="<?php if ($term == "Energia" && $plazo == "largo-plazo") echo 'selected-dashboard-item'; ?>">Largo Plazo</a></li>
                        </ul>
                    </li>
                </ul>
            </li>
            <li>
                <a href="<?php echo Helpers::get_user_contact_url(); ?>" class="contacto <?php if (Helpers::get_user_contact_url() == $current_url_link) echo 'selected-dashboard-item'; ?>">Contacto</a>
            </li>
        </ul>
    </nav>

</aside>